home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / p / pcqpascalv1.2d.lha / Examples2 / SuperViewPCQ / PCQ / include / SV / superview / superview.i next >
Encoding:
Text File  |  1997-05-06  |  12.5 KB  |  371 lines

  1. {  superview/superview.i            }
  2. {  Version    : 7.1                 }
  3. {  Date       : 16.07.1994          }
  4. {  Written by : Andreas R. Kleinert }
  5. {  PCQ - Konvertierung by Andreas Neumann }
  6.  
  7.  
  8. {  *************************************************** }
  9. {  *                                                 * }
  10. {  * Version Defines                                 * }
  11. {  *                                                 * }
  12. {  *************************************************** }
  13.  
  14. CONST
  15.     SVLIB_VERSION   =   7;
  16.  
  17.  
  18. {  *************************************************** }
  19. {  *                                                 * }
  20. {  * Includes                                        * }
  21. {  *                                                 * }
  22. {  *************************************************** }
  23.  
  24. { PCQ : für OS_VER }
  25. {$I "Include:exec/Execbase.i"}
  26.  
  27. {$I "Include:libraries/dos.i" }
  28.  
  29. {$I "Include:Utils/Stringlib.i" }
  30.  
  31. {$I "Include:sv/SuperView/SVInfo.i" }
  32.  
  33.  
  34. {  *************************************************** }
  35. {  *                                                 * }
  36. {  * Custom Defines                                  * }
  37. {  *                                                 * }
  38. {  *************************************************** }
  39.  
  40.  
  41. CONST
  42.     N   =   NIL;
  43.  
  44.  
  45. {  *************************************************** }
  46. {  *                                                 * }
  47. {  * MACROs for Version-Tests                        * }
  48. {  *                                                 * }
  49. {  *************************************************** }
  50.  
  51.  
  52. FUNCTION LibVer (x : LibraryPtr) : Short;
  53.  
  54. BEGIN
  55.  LibVer:=x^.lib_version;
  56. END;
  57.  
  58. FUNCTION OS_VER : Short;
  59.  
  60. VAR EBase   :   ExecBasePtr;
  61.  
  62. FUNCTION GetEBase : Address;
  63.  
  64. BEGIN
  65. {$A
  66.         move.l  $4,d0
  67. }
  68. END;
  69.  
  70. BEGIN
  71.  EBase:=GetEBase;
  72.  IF EBase<>NIL THEN
  73.   OS_VER:=LibVer (Adr(EBase^.LibNode));
  74. END;
  75.  
  76.  
  77. {  *************************************************** }
  78. {  *                                                 * }
  79. {  * DEFINES                                         * }
  80. {  *                                                 * }
  81. {  *************************************************** }
  82.  
  83.  
  84. {  Possible FileTypes }
  85.  
  86. CONST
  87.     SV_FILETYPE_NONE    :   INTEGER = 0;
  88.     SV_FILETYPE_UNKNOWN :   INTEGER = SV_FILETYPE_NONE;
  89.     SV_FILETYPE_ILLEGAL :   INTEGER = $FFFFFFFF;
  90.  
  91.     SV_FILETYPE_ILBM    :   INTEGER =   1;      { IFF-ILBM, any derivat }
  92.     SV_FILETYPE_ACBM    :   INTEGER =   2;      { IFF-ACBM, any derivat }
  93.     SV_FILETYPE_DATATYPE :  INTEGER =   3;      { V39-Datatype-Object   }
  94.  
  95.     {
  96.         up to here  : Constant codes for IFF-ILBM, IFF-ACBM and DataTypes
  97.                       (constant for compatibility reasons).
  98.         above these : External, user defined FileSubTypes
  99.                       (defined EACH TIME NEW at Library's startup-time).
  100.     }
  101.  
  102.  
  103. {  Possible SubTypes of FileTypes }
  104.  
  105.     SV_SUBTYPE_NONE     :   INTEGER =   0;
  106.     SV_SUBTYPE_UNKNOWN  :   INTEGER =   SV_SUBTYPE_NONE;
  107.     SV_SUBTYPE_ILLEGAL  :   INTEGER =   $FFFFFFFF;
  108.  
  109.     SV_SUBTYPE_ILBM     :   INTEGER =   1;      { Is IFF-ILBM              }
  110.     SV_SUBTYPE_ILBM_01  :   INTEGER =   2;      { Is IFF-ILBM, CmpByteRun1 }
  111.     SV_SUBTYPE_ACBM     :   INTEGER =   3;      { Is IFF-ACBM              }
  112.     SV_SUBTYPE_DATATYPE :   INTEGER =   4;      { Is V39-DataType-Object   }
  113.  
  114.     {
  115.         up to here  : Constant codes for IFF-ILBM, IFF-ACBM and DataTypes
  116.                       (constant for compatibility reasons).
  117.         above these : External, user defined FileSubTypes
  118.                       (defined EACH TIME NEW at Library's startup-time).
  119.     }
  120.  
  121.  
  122. { Possible Input and Output mediums }
  123.  
  124.     AKO_MEDIUM_NONE     :   INTEGER =   0;          { means : DEFAULT       }
  125.     AKO_MEDIUM_ILLEGAL  :   INTEGER =   $FFFFFFFF;
  126.  
  127.     AKO_MEDIUM_DISK     :   INTEGER =   1;          { Read and Write media  }
  128.     AKO_MEDIUM_CLIP     :   INTEGER =   2;
  129.  
  130.     { not any medium might be supported by any SVObject }
  131.  
  132.  
  133. {  *************************************************** }
  134. {  *                                                 * }
  135. {  * Function Error Codes                            * }
  136. {  *                                                 * }
  137. {  *************************************************** }
  138.  
  139.     SVERR_MAX_ERROR_TEXT_LENGTH :   INTEGER =   80;     { plus Null-Byte }
  140.  
  141.     SVERR_NO_ERROR              :   INTEGER =   0;
  142.     SVERR_INTERNAL_ERROR        :   INTEGER =   $FFFFFFFF;
  143.  
  144.     SVERR_UNKNOWN_FILE_FORMAT   :   INTEGER =   1;
  145.     SVERR_FILE_NOT_FOUND        :   INTEGER =   2;
  146.     SVERR_NO_MEMORY             :   INTEGER =   3;
  147.     SVERR_IFFPARSE_ERROR        :   INTEGER =   4;
  148.     SVERR_NO_CLIPBOARD          :   INTEGER =   5;
  149.     SVERR_NO_SCREEN             :   INTEGER =   6;
  150.     SVERR_NO_FILE               :   INTEGER =   7;
  151.     SVERR_NO_HANDLE             :   INTEGER =   8;
  152.     SVERR_NO_DATA               :   INTEGER =   9;
  153.     SVERR_GOT_NO_WINDOW         :   INTEGER =   10;
  154.     SVERR_GOT_NO_SCREEN         :   INTEGER =   11;
  155.     SVERR_NO_INFORMATION        :   INTEGER =   12;
  156.     SVERR_ILLEGAL_ACCESS        :   INTEGER =   13;
  157.     SVERR_DECODE_ERROR          :   INTEGER =   14;
  158.     SVERR_UNKNOWN_PARAMETERS    :   INTEGER =   15;
  159.     SVERR_ACTION_NOT_SUPPORTED  :   INTEGER =   16;
  160.     SVERR_VERSION_CONFLICT      :   INTEGER =   17;
  161.     SVERR_NO_DRIVER_AVAILABLE   :   INTEGER =   18;
  162.  
  163.         {  Each new Library-Subversion may contain new Codes above
  164.            the last one of these.
  165.            So do not interpret the codes directly, but use
  166.            SVL_GetErrorString().
  167.            Maybe, newer Codes will not be listed up here.
  168.         }
  169.  
  170. TYPE
  171.     SV_GfxBuffer    =   RECORD
  172.  {  All pointers (e.g. svgfx_Buffer) have to be and are AllocVec()'ed.
  173.  
  174.     If you did not allocate SV_GfxBuffers by yourself, you must
  175.     neither free them nor do write-accesses to them.
  176.  
  177.     If you allocated them by yourself, you also have to free them
  178.     by yourself - if no one else is still accessing them.
  179.  }
  180.  
  181.         svgfx_Version   :   INTEGER;        { structure version, see below  }
  182.  
  183.         svgfx_BufferType :  INTEGER;        { Data organization, see below  }
  184.  
  185.         svgfx_Width     :   INTEGER;        { Graphic's Width               }
  186.         svgfx_Height    :   INTEGER;        { Graphic's Height              }
  187.         svgfx_ColorDepth :  INTEGER;        { Graphic's ColorDepth          }
  188.         svgfx_ViewMode32 :  INTEGER;        { if NULL, best ScreenMode is
  189.                                               suggested
  190.                                               (results in LowRes, if not
  191.                                               changed).                     }
  192.  
  193.         svgfx_Colors    :   ARRAY [1..256] OF ARRAY [1..3] OF BYTE; { For ColorDepth <= 8 : 3-Byte RGB entries  }
  194.  
  195. {
  196. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  197. begin of "case-dependent" entries
  198. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  199.  
  200.     ONLY if svgfx_BufferType == SVGFX_BUFFERTYPE_BITPLANE, else NULL.
  201.  
  202.     svgfx_BytesPerLine :
  203.  
  204.        size of one row
  205.        of a plane in Bytes
  206.      = Bytes per Row            : (( [width] +7)>>3)
  207.        Number of Rows per Plane : [height]
  208.        Number of Planes         : [depth]
  209.  
  210.  }
  211.  
  212.     svgfx_BytesPerLine  :   INTEGER; { see above }
  213.     svgfx_PixelBits     :   INTEGER; { see below }
  214.  
  215. {
  216.     ONLY if svgfx_BufferType == SVGFX_BUFFERTYPE_ONEPLANE, else NULL.
  217.  
  218.     svgfx_PixelBits    :
  219.  
  220.        Bits Per Pixel
  221.        (8, 16, 24, ...)
  222.     => Bytes per Row            : (svgfx_PixelBits>>3) * [width]
  223.        Number of Rows per Plane : [height]
  224.        Number of Planes         : ONE
  225.  
  226. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  227. end of "case-dependent" entries
  228. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  229.  }
  230.  
  231.  
  232.     svgfx_Buffer    :   ADDRESS; { any kind of memory (no chip ram needed)  }
  233.     svgfx_BufferSize :  INTEGER; { if you want to copy it ...               }
  234.  
  235.  
  236.  { size of structure may grow in future versions : Check svgfx_Version ! }
  237.  
  238.                         END;
  239.    SV_GfxBufferPtr = ^SV_GfxBuffer;
  240.  
  241.  
  242. CONST
  243.     SVGFX_VERSION   =   1;
  244.  
  245.     SVGFX_BUFFERTYPE_BITPLANE   =   1;  { Amiga-like BitPlanes          }
  246.     SVGFX_BUFFERTYPE_ONEPLANE   =   2;  { single Byte-/Word-/24 Bit-Plane }
  247.  
  248. {  there may be more types in the future }
  249. {  (at least reject all types > 2)       }
  250.  
  251.  
  252. {
  253.    Some words about interpreting and using SV_GfxBuffer structures
  254.    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  255.  
  256.    SVGFX_BUFFERTYPE_BITPLANE
  257.    =========================
  258.  
  259.    SVGFX_BUFFERTYPE_BITPLANE means, that there's plane stored after plane,
  260.    but _no padding_ of the lines is done (e.g. to word- or longword-
  261.    boundaries), which is different from Amiga-BPs or ACBM-ABITs :
  262.  
  263.          | line 1 of plane 1              | (each with svgfx_BytesPerLine)
  264.          | ...                            |
  265.          | line [height] of plane 1       |
  266.  
  267.                ...
  268.  
  269.          | line 1 of plane []             |
  270.          | ...                            |
  271.          | line [height] of plane []      |
  272.  
  273.                ...
  274.  
  275.          | line 1 of plane [depth]        |
  276.          | ...                            |
  277.          | line [height] of plane [depth] |
  278.  
  279.  
  280.    SVGFX_BUFFERTYPE_BITPLANE is only used upto 256 Colors at the time :
  281.    16 and 24 Bit data will usually not be stored this way.
  282.  
  283.  
  284.    SVGFX_BUFFERTYPE_ONEPLANE
  285.    =========================
  286.  
  287.    SVGFX_BUFFERTYPE_ONEPLANE means, that there's only one single plane stored.
  288.    The size of one pixel in this plane is defined in svgfx_PixelBits
  289.    (currently 8 for ChunkyPixel graphics or 24 for 24 Bit graphics).
  290.  
  291.          | line 1 with ([PixelBits] / 8) * [width] Bytes        |
  292.          | ...                                                  |
  293.          | line [height] with ([PixelBits] / 8) * [width] Bytes |
  294.  
  295.  
  296.    8 Bit  : Chunky Pixel (ColorMap) = 8       ; ColorRegister index
  297.    16 Bit : R:G:B                   = 5:5:5:1 ; + 1 Bit Alpha Channel : IGNORED
  298.    24 Bit : R:G:B                   = 8:8:8   ; RGB-value
  299.  
  300.  
  301.    So   8 Bit Data contains [height]   bytes in a row,
  302.        16 Bit Data contains [height]*2 bytes in a row
  303.    and 24 Bit Data contains [height]*3 bytes in a row.
  304.  
  305.    Currently you will not find any SV_GfxBuffers with 16 Bit data,
  306.    but this may change in the future.
  307.  
  308.  
  309.    Differences, which perhaps are not obviously
  310.    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  311.  
  312.    In SV_GfxBuffer structures there are two "case-dependent" entries
  313.    (see structure definition of SV_GfxBuffer) :
  314.  
  315.    BITPLANE :   svgfx_BytesPerLine = ( [width] +7 )>>3
  316.                 svgfx_PixelBits    = 0;                   ** IGNORE IT
  317.                 svgfx_ColorDepth   = [number of planes]
  318.  
  319.    ONEPLANE :   svgfx_BytesPerLine = 0;                   ** IGNORE IT
  320.                 svgfx_PixelBits    = 8;                   ** or == 24
  321.                 svgfx_ColorDepth   = [used PixelBits]
  322.  
  323.  
  324.    svgfx_ColorDepth always describes the _real_ ColorDepth of the graphics,
  325.    which means the stored number of planes for BITPLANE data and the number
  326.    of _actually_ used pixelbits for ONEPLANE data.
  327.  
  328.    If svgfx_PixelBits is 24, svgfx_ColorDepth will perhaps always be 24, too.
  329.    But if svgfx_PixelBits is 8, it may be anything between 1 and 8.
  330.  
  331.    The reason is, that e.g. GIF pictures are always stored 8 Bit-wide,
  332.    no matter if they contain 4, 8 or 256 Colors.
  333.    This is just because these 8 Bit are simply a ColorRegister index
  334.    (into the field of RGB-Colors : svgfx_Colors).
  335.  
  336.    OK, there's no problem in displaying a ONEPLANE-8 graphics on a 256 Color
  337.    Screen, no matter which value svgfx_ColorDepth actually contains.
  338.    But if svgfx_ColorDepth is, let's say, only 4, this will be just a
  339.    waste of memory (and the last 256-16 = 240 colors will be black, anyway).
  340.  
  341.    So finally we can say, that the data in a ONEPLANE SV_GfxBuffer is just
  342.    stored the same way, as e.g. in ChunkyPixel modes of VGA-like Graphic Cards
  343.    or in the source-buffers for GfxLibs's WritePixelLine8().
  344.    (See "graphics.library"'s AutoDocs for more information on ChunkyPixel
  345.     buffer (PixelLine8) handling under V37/39 with ECS/AGA.)
  346.  
  347.  
  348.    Which kind of data-storage is more likely ?
  349.    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  350.    The ways of data-storage only depends the specific SVObjects.
  351.  
  352.    Some Examples :
  353.  
  354.    FileType   BufferType     PixelBits    ColorDepth
  355.  
  356.    GIF        ONEPLANE       8            1..8
  357.    ILBM       BITPLANE       -            1..8
  358.    JPGE       ONEPLANE       8/24         8/24
  359.  
  360.    ( an : Hier meint der Andi wohl nicht JPGE sondern JPEG.... )
  361.  
  362.    So any program, which supports GfxBuffers should handle both formats.
  363.    This is not difficult, since superviewsupport.library
  364.    contains functions to convert ONEPLANE buffers into BITPLANE buffers
  365.    and vice versa.
  366.    So you actually only have to support one of the data-storage alternatives.
  367.  
  368.    (See Example-SourceCodes for more and detailed information !)
  369. }
  370.  
  371.